/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package network;

import java.io.FileNotFoundException;
import java.io.IOException;
import weibo4j.model.WeiboException;

/**
 *
 * @author Administrator
 */
public class relationScore {

    static double alpha = 2;

    public static void relationScore(DataPreparation data) throws FileNotFoundException, IOException, WeiboException, InterruptedException {
        cLeaderRank.cLeaderrank(data);
        cJaccard.cjaccard(data);
        cInfluence.cInfluence(data);
        //printResult(data);
    }

    public static void printResult(DataPreparation data) {
        data.data.mFIDs.remove("0");
        data.data.mFIDs.remove(Config.uid);
        String uid = Config.uid;
        int bicount = data.data.mBiFIDs.size();
        if (data.data.mBiFIDs.contains("0")) {
            bicount -= 1;
            if (data.data.mBiFIDs.contains(uid)) {
                bicount -= 1;
            }
        }
        int fcount = data.data.mFIDs.size();
        if (data.data.mFIDs.contains("0")) {
            fcount -= 1;
            if (data.data.mFIDs.contains(uid)) {
                fcount -= 1;
            }
        }
        System.out.println("username " + "influence " + "jaccard " + "leaderrank " + "comments " + "reposts " + "latest " + "commonFriends");
        for (String id : data.data.mFIDs) {
            if (id.equals("0") || id.equals(uid)) {
                continue;
            }
            double jaccard = data.jaccard.get(id);
            double leaderrank = data.S.get(id);
            String un = data.data.username.get(id);

            int comCount = 0;
            if (data.data.comment.get(id) != null) {
                comCount = data.data.comment.get(id);
            }
            double influence = data.influence.get(id);
            int bfCount = 0;
            int repCount = 0;
            int lcount = 0;
            if (data.data.repost.get(id) != null) {
                repCount = data.data.repost.get(id);
            }
            if (data.data.latest.get(id) != null) {
                lcount = data.data.latest.get(id);
            }
            if (data.data.biFCount.containsKey(id)) {
                bfCount = data.data.biFCount.get(id);
            }
            System.out.println(un + " " + influence + " " + jaccard + " " + leaderrank + " " + comCount + " " + repCount + " " + lcount + " " + bfCount);
        }
        System.out.println(fcount + " " + bicount);
    }
}
